Page({

  data: {
    width: 300,
    height: 300,
    renderWidth: 300,
    renderHeight: 300,
    loaded: false,
    spuId: null,
    xrInfo: {
      openType: 'lo',
      img: null,
    },
    options: {
      openTypeOptions: [
        { label: "左内开", value: "li" },
        { label: "左外开", value: "lo" },
        { label: "右内开", value: "ri" },
        { label: "右外开", value: "ro" },
      ]
    }
  },
  onLoad(options) {
    const { spuId } = options;
    this.setData({ spuId })
    const info = wx.getSystemInfoSync();
    const width = info.windowWidth;
    const height = info.windowHeight * 0.7;
    const dpi = info.pixelRatio;
    this.setData({
      width, height,
      renderWidth: width * dpi,
      renderHeight: height * dpi
    });
  },
  handleLoaded: function ({ detail }) {
    this.setData({ loaded: true });
    this.scene = detail;
  },
  handleSyncPositions: function ({ detail }) {
    this.setData({ positions: detail });
  },
  onChangeOpenType(e) {
    console.log('onChangeOpenType: ', e.detail.value);
    this.setData({ "xrInfo.openType": e.detail.value });
  },
  handleShare() {
    console.log('handleShare...')
    this.selectComponent('#main-frame').handleShare();
    // // 判断当前客户端是否支持分享系统
    // const supported = this.scene.share.supported;
    // console.log('share supported: ', supported)
    // this.scene.share.captureToDataURL();
  },
  handleDown() { },
})